package com.lvmama.rhino.common.utils.hbase

import com.lvmama.rhino.common.utils.hbase.conversion.FieldReader
import org.apache.spark.SparkContext

import scala.reflect.ClassTag

/**
  * Created by yuanxiaofeng on 2016/7/18.
  */
class HBaseSparkContext(@transient val sc: SparkContext) extends Serializable {

  def hbaseTable[R: ClassTag](table: String)(implicit mapper: FieldReader[R]): HBaseReaderBuilder[R] = new HBaseReaderBuilder[R](sc, table=table)

}

trait HBaseSparkContextConversions extends Serializable {
  // Include new methods into the SparkContext object
  implicit def toHBaseSparkContext(sc: SparkContext): HBaseSparkContext = new HBaseSparkContext(sc)
}
